//
// Created by Administrator on 2021/8/13.
//
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <climits>

using namespace std;

class Solution {
public:
    vector<int> numberOfLines(vector<int> &widths, string s) {
        int level = 1; // 需要的行数
        int levelLength = 0; // 这一行已经写了多长
        for(auto &x:s){
            int charLength = widths[x-'a'];
            if (charLength + levelLength > 100){
                ++ level; // 开新的一层
                levelLength = charLength;
            }
            else
                levelLength += charLength;
        }
        return {level,levelLength};

    }
};

int main() {
    vector<int> width{10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
                      10};
    Solution solution;
    auto ans = solution.numberOfLines(width, "abcdefghijklmnopqrstuvwxyz");
    cout << ans[0] << endl;
    cout << ans[1] << endl;
    return 0;
}
